import PyPDF2
from PyPDF2.pdf import PageObject

# 读取源文件
reader1 = PyPDF2.PdfFileReader("")
# 读取水印文件
reader2 = PyPDF2.PdfFileReader("")

writer = PyPDF2.PdfFileWriter()

# 获取水印页
watermark_page = reader2.getPage(0)
for page_num in range(reader1.numPages):
    current_page = reader1.getPage(page_num)
    # 将源文件的每一页和水印页合并
    current_page.mergePage(watermark_page)
    writer.addPage(current_page)

# 将添加完水印的pdf文件写入到新文件中
with open("", "wb") as file:
    writer.write(file)


